~route_head();
int rte_waypt_ct() const {return waypoint_list.count();} /* # waypoints in waypoint list */
+ bool rte_waypt_empty() const {return waypoint_list.empty();}
};
using route_hdr = void (*)(const route_head*);
cur_info = &route_info[route_idx];
cur_info->prev_wpt = nullptr;
cur_info->total = 0;
- if (rte->rte_waypt_ct() <= 0) {
+ if (rte->rte_waypt_empty()) {
return;
}
cur_info = &route_info[route_idx];
cur_info->prev_wpt = nullptr;
cur_info->total = 0;
- if (track->rte_waypt_ct() <= 0) {
+ if (track->rte_waypt_empty()) {
return;
}
#define DBG(a,b) if ((GDB_DEBUG & (a)) && (b))
-#define ELEMENTS(a) a->rte_waypt_ct()
#define NOT_EMPTY(a) (a && *a)
void
route_compute_bounds(rte, &bounds);
route_write_bounds(&bounds);
- int points = ELEMENTS(rte);
+ int points = rte->rte_waypt_ct();
FWRITE_i32(points);
int index = 0;
void
GdbFormat::write_track(const route_head* trk, const QString& trk_name)
{
- int points = ELEMENTS(trk);
+ int points = trk->rte_waypt_ct();
FWRITE_CSTR(trk_name);
FWRITE_C(0);
void
GdbFormat::write_route_cb(const route_head* rte)
{
- if (ELEMENTS(rte) <= 0) {
+ if (rte->rte_waypt_empty()) {
return;
}
void
GdbFormat::write_track_cb(const route_head* trk)
{
- if (ELEMENTS(trk) <= 0) {
+ if (trk->rte_waypt_empty()) {
return;
}
static void count_track_styles(const route_head* rte)
{
- if (rte->rte_waypt_ct() > 0) {
+ if (!rte->rte_waypt_empty()) {
ts_count++;
}
}
static void write_trk_style(const route_head* trk)
{
- if (trk->rte_waypt_ct() > 0) {
+ if (!trk->rte_waypt_empty()) {
fwrite_string(file_out, trk->rte_name);
fwrite_byte(file_out, 1);
fwrite_long(file_out, 0);
trk_head = nullptr;
last_time = 0;
- if (trk->rte_waypt_ct() > 0) {
+ if (!trk->rte_waypt_empty()) {
trk_head = (humminbird_trk_header_t*) xcalloc(1, sizeof(humminbird_trk_header_t));
trk_points = (humminbird_trk_point_t*) xcalloc(max_points, sizeof(humminbird_trk_point_t));
HumminbirdFormat::humminbird_rte_head(const route_head* rte)
{
humrte = nullptr;
- if (rte->rte_waypt_ct() > 0) {
+ if (!rte->rte_waypt_empty()) {
humrte = (humminbird_rte_t*) xcalloc(1, sizeof(*humrte));
}
}
if (wpt_timespan_begin.isValid() && wpt_timespan_end.isValid()) {
// If there are some Waypoints, then distribute the TimeSpan to all Waypoints
- if (trk_head->rte_waypt_ct() > 0) {
+ if (!trk_head->rte_waypt_empty()) {
qint64 timespan_ms = wpt_timespan_begin.msecsTo(wpt_timespan_end);
if (trk_head->rte_waypt_ct() < 2) {
fatal(MYNAME ": attempt to interpolate TimeSpan with too few points.");
writer->writeOptionalTextElement(QStringLiteral("name"), header->rte_name);
kml_output_trkdescription(header, td);
- if (export_points && header->rte_waypt_ct() > 0) {
+ if (export_points && !header->rte_waypt_empty()) {
// Put the points in a subfolder
writer->writeStartElement(QStringLiteral("Folder"));
writer->writeTextElement(QStringLiteral("name"), QStringLiteral("Points"));
void KmlFormat::kml_output_tailer(const route_head* header)
{
- if (export_points && header->rte_waypt_ct() > 0) {
+ if (export_points && !header->rte_waypt_empty()) {
writer->writeEndElement(); // Close Folder tag
}
// Add a linestring for this track?
- if (export_lines && header->rte_waypt_ct() > 0) {
+ if (export_lines && !header->rte_waypt_empty()) {
bool needs_multigeometry = false;
foreach (const Waypoint* tpt, header->waypoint_list) {
void KmlFormat::kml_track_hdr(const route_head* header) const
{
computed_trkdata td = track_recompute(header);
- if (header->rte_waypt_ct() > 0 && (export_lines || export_points)) {
+ if (!header->rte_waypt_empty() && (export_lines || export_points)) {
kml_output_header(header, &td);
}
}
void KmlFormat::kml_track_tlr(const route_head* header)
{
- if (header->rte_waypt_ct() > 0 && (export_lines || export_points)) {
+ if (!header->rte_waypt_empty() && (export_lines || export_points)) {
kml_output_tailer(header);
}
}
void
OsmFormat::osm_rte_disp_head(const route_head* route)
{
- skip_rte = route->rte_waypt_ct() <= 0;
+ skip_rte = route->rte_waypt_empty();
if (skip_rte) {
return;
break;
case 2:
/* new track flag */
- if ((str.toInt() == 1) && (trk_head->rte_waypt_ct() > 0)) {
+ if ((str.toInt() == 1) && !trk_head->rte_waypt_empty()) {
trk_head = new route_head;
track_add_head(trk_head);
if (trk_name) {
void PositionFilter::position_process_any_route(const route_head* rh, int type)
{
- if (rh->rte_waypt_ct() != 0) {
+ if (!rh->rte_waypt_empty()) {
cur_rte = const_cast<route_head*>(rh);
position_runqueue(&cur_rte->waypoint_list, type);
cur_rte = nullptr;
void TrackFilter::trackfilter_fill_track_list_cb(const route_head* track) /* callback for track_disp_all */
{
- if (track->rte_waypt_ct() == 0) {
+ if (track->rte_waypt_empty()) {
track_del_head(const_cast<route_head*>(track));
return;
}
// Uggh. strftime format exposed to user.
gpsbabel::DateTime dt;
- if (track->rte_waypt_ct() == 0) {
+ if (track->rte_waypt_empty()) {
dt = default_time;
} else {
auto* wpt = track->waypoint_list.front();
}
}
- if (master->rte_waypt_ct() == 0) {
+ if (master->rte_waypt_empty()) {
track_del_head(master);
track_list.clear();
}
}
}
- if (track->rte_waypt_ct() == 0) {
+ if (track->rte_waypt_empty()) {
track_del_head(track);
it = track_list.erase(it);
} else {